fork download
  1. word = list(input().upper()); abclist = {}
  2.  
  3. if 1 <= len(word) <= 1000000:
  4. for n in word:
  5. if 65<=ord(n)<=90:
  6. try: abclist[n] += 1
  7. except: abclist[n] = 1
  8.  
  9. abcmax = [val for val in abclist.values()]; max_value = max(abcmax); cnt = 0
  10. for n in range(len(abclist.values())):
  11. if abcmax[n] == max(abcmax):
  12. cnt+=1
  13.  
  14. if cnt == 1:
  15. print(word[abcmax.index(max_value)])
  16. else:
  17. print('?')
Success #stdin #stdout 0.03s 9712KB
stdin
AABBB
stdout
A